/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ftpcombiner.listeners;

import ftpcombiner.ApplicationController;
import ftpcombiner.filesystem.FileSystem;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import javax.swing.JFileChooser;

/**
 *
 * @author Ben
 */
public class UploadListener extends MouseAdapter {

    private JFileChooser uploadChooser;

    public UploadListener() {
        uploadChooser = new JFileChooser();
        uploadChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        uploadChooser.setMultiSelectionEnabled(true);
    }

    @Override
    public final void mouseReleased(MouseEvent e) {
        uploadChooser.showDialog(ApplicationController.getInstance().getApplicationFrame(), "Upload");
        for (File file : uploadChooser.getSelectedFiles()) {
            FileSystem.getInstance().upload(file);
        }
    }
}
